Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(chat): add /schema command handler VSCODE-571 #820

Merged
merged 5 commits into from
Sep 23, 2024

Conversation

Anemy
Copy link
Member

@Anemy Anemy commented Sep 17, 2024

VSCODE-571

Adds a schema command that passes a collection's schema to the model. With an open schema button. Uses the mongodb-schema package.

REC-20240917172516.mp4

@Anemy Anemy marked this pull request as ready for review September 20, 2024 18:34
});
await vscode.window.showTextDocument(document, { preview: true });
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we show the schema in the Playground Result pane, like we display the result of executable code blocks from chat participants?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I went with this approach, using a new json document view with preview, instead of a playground result pane for a couple reasons:

  • It allows for JSON support.
  • A preview is more ephemeral which is what I was thinking we want for something like this that folks want to copy paste or view quickly. It's replaced by other previews as well.
  • This is the result of a schema run, and not something that is from running a playground, so naming it wouldn't be quite right.
    Are there reasons we would want to reuse the result pane?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the results panel, you can also set the json language. I don't have a strong opinion on where the schema output should be, more like raising a question to think about. For me, the schema output looks pretty much the same as the export to language output, which we also show in the results pane. Only Shema will behave differently if we open it as a preview text document. On the other hand, we open documents from the sidebar also as json pages. If you feel strongly about this behavior, I don't mind keeping it as is. Just want to make sure this is what users would feel more natural about.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good. I'm merging it in like this - FWIW this is a pretty simple implementation to show a json doc, so we can swap it out easily down the line if we find using the playground results would be better.

@Anemy Anemy merged commit 263b043 into VSCODE-528-mongodb-copilot Sep 23, 2024
3 checks passed
@Anemy Anemy deleted the VSCODE-571-schema-command branch September 23, 2024 11:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants